<div class="bjui-pageHeader" style="background-color:#fefefe; border-bottom:none;">
	<form data-toggle="ajaxsearch" data-options="{searchDatagrid:$.CurrentNavtab.find('#datagrid-data')}">
	    <fieldset>
	        <legend style="font-weight:normal;">页头搜索：</legend>
	        <div style="margin:0; padding:1px 5px 5px;">
	            <span>昵称：</span>
	            <input type="text" name="obj.nickname" class="form-control" size="15">
	                
	            <div class="btn-group">
	                <button type="submit" class="btn-green" data-icon="search">开始搜索！</button>
	                <button type="reset" class="btn-orange" data-icon="times">重置</button>
	            </div>
	        </div>
	    </fieldset>
	</form>
</div>

<div class="bjui-pageContent" style="width: 100%;">
	<table class="table table-bordered" id="datagrid-data" data-width="100%" data-toggle="datagrid" data-options="{
        height: '100%',
	    tableWidth:'98%',
        delPK:'id',
        gridTitle : '用户列表',
        showToolbar: true,
        toolbarItem: 'add,del',
        dataUrl: '{{url("admin/user")}}?callback=?',
        dataType: 'jsonp',
        postData:{_token:'{{csrf_token()}}'},
        jsonPrefix: 'obj',
        editMode: {dialog:{width:'500',height:300,title:'编辑用户信息',mask:true}},
        editUrl: '{{url("admin/user/edit")}}?_token={{csrf_token()}}',
        delUrl:'{{url("admin/user/userDel")}}',
        delType:'GET',
        paging: {pageSize:60},
        showCheckboxcol: true,
        linenumberAll: true
   }">
    	<thead>
	    	<tr>
	            <th data-options="{name:'id',align:'center',width:50}">ID</th>
	            <th data-options="{name:'email',align:'center',width:200}">邮箱</th>
	            <th data-options="{name:'nickname',align:'center'}">用户昵称</th>
	            <th data-options="{name:'created_at',align:'center',type:'date',pattern:'yyyy-MM-dd',width:200}">创建时间</th>
	            <th data-options="{name:'updated_at',align:'center',type:'date',pattern:'yyyy-MM-dd',width:200}">更新时间</th>
	            <th data-options="{name:'activated',align:'center',type:'boolean',render:function(value){return value ? '√' : '×'}}">是否启用</th>
	            <th data-options="{name:'group',align:'center',quickfilter:false,quicksort:false,render:user_group}">所属用户组</th>
	            <th data-options="{align:'center',render:datagrid_tree_operation,width:120}">操作列</th>
	        </tr>
	        
       </thead>
  </table>
</div>

<script>
	function datagrid_tree_operation() {
	    var html = '<button type="button" class="btn-green" data-toggle="edit.datagrid.tr">编辑</button>'
	        + '<button type="button" class="btn-red" data-toggle="del.datagrid.tr">删除</button>'
	    return html
	}
	function user_group(value){
		var v='';
		for(var i=0;i<value.length;i++){
			v+=value[i].name+','
		}
		return v;
	}
</script>